package com.foxzzz.osf.store;

public abstract class AbstractPage<T> {
    private long start;
    private int size;
    private T data;

    public AbstractPage(long start, int size) {
        this.start = start;
        this.size = size;
    }

    public void setData(T data) {
        this.data = data;
    }


    public T getData() {
        return this.data;
    }

    public long getStart() {
        return this.start;
    }

    public int getSize() {
        return this.size;
    }

    public long getEnd() {
        return this.size + this.start;
    }

    protected abstract T loadData();

    protected abstract void flushData(T data);

    public void load() {
        this.data = loadData();
    }

    public void flush() {
        flushData(data);
    }
}
